Release 10.1A: OpenEdge Development:
ProDataSets
Using the SAVE-WHERE-STRING attribute
As outlined in the previous section, the first step in saving a change is to locate the database buffer the temp-table row was derived from. Progress can always determine how to identify that row, based on the
KEYSphrase of the Data-Source or the primary key of the database table, but it is not always trivial for you to determine the same information in your procedures. For this reason, there is aSAVE-WHERE-STRINGattribute on the Data-Source to return to you the where-clause you would need to use to retrieve the same record yourself, as shown:
As with
SAVE-ROW-CHANGES,SAVE-WHERE-STRINGdefaults to the first (or only) buffer in the Data-Source. The attribute value is set internally by Progress to be thewhere-clausephrase (including the initial keywordWHERE) needed to find the database buffer identified by thebuffer-indexorbuffer-namewithin the Data-Source. This can be useful when you need to build up custom code to retrieve database records of changed buffers, if using theSAVE-ROW-CHANGESmethod is not adequate. If you specify abuffer-index, it is the sequential position of the buffer within the list of multiple buffers for the Data-Source. If you specify thebuffer-name, it must be the name of an after-table buffer in the list of buffers attached to the Data-Source. The buffer must be one that has a before-table, either static or dynamic. The attribute value qualifies field names in the buffer’s temp-table with the before-table name, not the after-table name. This is because this string can be used to find database records based on field values in the before-table rows, as your code is cycling through the before-table, processing each change.If an error occurs during the database update, the
ERRORattribute is set to true for the ProDataSet, the temp-table where the error occurred, and the buffer where the error occurred.Table 6–2 summarizes all these change methods and the handles they can be used on.
In summary:
- You execute a method on a ProDataSet handle to affect the entire ProDataSet.
- You execute a method on a temp-table buffer handle to affect that one temp-table.
- You don’t execute any of these methods on a temp-table handle. However, the
TRACKING-CHANGESattribute is on the temp-table handle.- There’s no row
-level method forGET-CHANGES. You execute this only for an entire temp-table or ProDataSet.- There’s only a row
-level method for saving changes.- The row-level method is executed on the temp-table buffer handle. The name tells Progress whether to act on a single row or the entire table.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |